package com.yyh;

public class Point {
    //属性
    //x轴点
    private double x;
    //y轴点
    private double y;
    //行为
    //无参构造方法
    public Point() {
    }
    //有参构造方法
    public Point(double x, double y) {
        this.x = x;
        this.y = y;
    }
    //getter and setter
    public double getX() {
        return x;
    }

    public void setX(double x) {
        this.x = x;
    }

    public double getY() {
        return y;
    }

    public void setY(double y) {
        this.y = y;
    }

    //计算一个点与另一个点之间的距离
    public double pp(Point other){
        double dx = this.x - other.x;
        double dy = this.y - other.y;
        return Math.sqrt(dx*dx+dy*dy);
    }
}
